package com.beiing.tianshuai.tianshuai.mine.presenter;

import com.beiing.tianshuai.tianshuai.base.BasePresenter;
import com.beiing.tianshuai.tianshuai.entity.CodeBean;
import com.beiing.tianshuai.tianshuai.entity.MyDiscoveryBean;
import com.beiing.tianshuai.tianshuai.mine.model.MyDiscoverModel;
import com.beiing.tianshuai.tianshuai.mine.model.MyDiscoverModelImpl;
import com.beiing.tianshuai.tianshuai.mine.view.MyDiscoverViewImpl;

/**
 * Created by Jinni on 2017/10/13 0013.
 */

public class MyDiscoverPresenter extends BasePresenter implements MyDiscoverPresenterImpl, MyDiscoverModel.OnRequestListener {

    private MyDiscoverViewImpl mView;
    private MyDiscoverModelImpl mModel;

    public MyDiscoverPresenter(MyDiscoverViewImpl view) {
        mView = view;
        mModel = new MyDiscoverModel(this);
    }

    @Override
    public void getMyDiscoveries(String uid) {
        mView.showProgress();
        mModel.getMyDiscoveries(uid);
    }

    @Override
    public void getDelDiscoveryResult(String id) {
        mView.showProgress();
        mModel.getDelDiscoveryResult(id);
    }

    @Override
    public void onSuccess(MyDiscoveryBean bean) {
        mView.hideProgress();
        mView.onRequestSuccess(bean);
    }

    @Override
    public void onDelSuccess(CodeBean bean) {
        mView.hideProgress();
        mView.onDelSuccess(bean);
    }

    @Override
    public void onError(Throwable throwable) {
        mView.hideProgress();
        mView.onRequestFailed(throwable);
    }
}
